Space Invaders
Earth is being invaded by martians. Here's a description of the
Martian fleet:
- The Martians have some spaceships.
- Each spaceship is either a mother ship or a drone.
- A mother ship has a name, which is a String, a crew, which is a
list of Martians, and a possibly-empty set of daughter ships, each
of which is a spaceship.
- When we say the fleet of a spaceship, we mean her daughter
ships and all their fleets.
- A Martian has a name, which is a string, and some other
attributes, which are unspecified.
Write functions to accomplish the following tasks:
- Given a spaceship, how many Martians named "Mork" are in the
crew of either the spaceship or its fleet?
- Given a spaceship, return another spaceship just like the
original, except that all of the ships in its fleet who have a
crewmember named "Mork" have been removed. When a ship is removed
from the fleet, so are all its daughters.
Last modified: Thu Oct 9 16:20:35 Eastern Daylight Time 2014